import request from '@/config/axios'

// 获取预支付订单
export const getPreOrder = async (orderNo) => {
  return await request.get({ url: `/system/pay/get-pre-order?preOrderNo=` + orderNo })
}

// 确认订单
export const confirmOrder = async (data) => {
  return await request.post({ url: `/system/pay/confirm`, data })
}
// 创建订单
export const createOrder = async (data) => {
  return await request.post({ url: `/system/pay/create`, data })
}

// 获取可支付的方式
export const getEnableCodeList = async (id) => {
  return await request.get({ url: `/pay/channel/get-enable-code-list?appId=` + id })
}

// 提交支付订单
export const orderSubmit = async (data) => {
  return await request.post({ url: `/pay/order/submit`, data })
}

// 查询订单详情
export const queryOrder = async (id) => {
  return await request.get({ url: `/system/pay/order?id=` + id })
}

// 查询订单是否完成支付
export const getOrderIsPaid = async (preOrderNo) => {
  return await request.get({ url: `/system/pay/get-order-is-paid?preOrderNo=` + preOrderNo })
}

// 余额充值
export const rechargeWallet = async (data) => {
  return await request.post({ url: `/system/pay/wallet`, data })
}

// 确认订单
export const confirmRenewalOrder = async (data) => {
  return await request.post({ url: `/system/pay/confirm-renewal`, data })
}
